<?php
/**
 * @package Flipper Open Source New Generation Blogging
 * @author Flipper Team <code@flipper.com>
 * @copyright Flipper Inc , 2011
 * @version 1.0
 * @name Flipper Config Class
 */
if ( ! defined('Flipper')) exit('Access allowed');

 class Flipper_config
 {

     public  static $config_cache = array();

     public static function run($config=null)
     {
         if(empty($config))
         {
             FpException::Error(1004);
         }



         if(array_key_exists($config, Flipper_config::$config_cache))
         {
             return Flipper_config::$config_cache[$config];
         }


         $config_file = APP_PATH.SP.'config'.SP.'fp_'.$config.EXP;

         if(!file_exists($config_file))
         {
             FpException::Error(1005);
         }

            /*** require  $config_file file ***/

            Flipper_config::$config_cache[$config] =  require $config_file;

         if(is_array(Flipper_config::$config_cache[$config]))
         {
             return Flipper_config::$config_cache[$config];

         }else{

             FpException::Error(1006);

         }


     }


 }

?>
